package com.zws.cucumber.util.cass;

import org.apache.commons.lang3.tuple.Pair;

import java.util.List;
import java.util.Map;

public interface ZwsCassTemplate {

    List<Map<String, Object>> queryList(String ql);

    Pair<Map<String, ColumnMetadata>, List<Map<String, Object>>> queryListWithMetadata(String cql);

    void execute(String cql);

    void executeBatch(List<String> cqlList);

    Map<String, ColumnMetadata> queryMetadata(String tableName);

    void cleanData(boolean onlyModifiedTables, String keyspace);

    void cleanData(String keyspace);

    void cleanData(String keyspace, String... tables);

    void truncate(String... tables);

    void printTable(String tableName);

    void printTable(String tableName, String whereClause);

    class ColumnMetadata {
        private final String name;
        private final ColumnType type;
        public ColumnMetadata(String name, ColumnType type) {
            this.name = name;
            this.type = type;
        }
        public String getName() {
            return name;
        }
        public ColumnType getType() {
            return type;
        }
    }

    enum ColumnType {
        STR,
        INT,

        MAP,
        SET,
        LIST,
        UDT,

        NIL,
    }
}
